package com.tjetc;

public class HtmlDocument {
    private String header = "";
    private String body = "";
    private String footer = "";

    public void addHeader(String header) {
        this.header = header;
    }

    public void addBody(String body) {
        this.body = body;
    }

    public void addFooter(String footer) {
        this.footer = footer;
    }

    @Override
    public String toString() {
        return "HtmlDocument{" +
                "header='" + header + '\'' +
                ", body='" + body + '\'' +
                ", footer='" + footer + '\'' +
                '}';
    }

    public static class Builder{
        public HtmlDocument document;

        public Builder(){
            document = new HtmlDocument();
        }

        public Builder addHeader(String header) {
            document.addHeader(header);
            return this;
        }

        public Builder addBody(String body) {
            document.addBody(body);
            return this;
        }

        public Builder addFooter(String footer) {
            document.addFooter(footer);
            return this;
        }


        public HtmlDocument build(){
            return document;
        }
    }

    public static void main(String[] args) {
        Builder builder = new Builder();
        HtmlDocument document = builder.addBody("body").addHeader("header").addFooter("footer").build();
        System.out.println(document);
    }
}
